package com.xuhuan.example.example013;

import java.io.PrintStream;

/**
 * @author: 徐欢
 * @date: 2023/11/12 11:12
 * @description:
 */
public class Example013 {

    public static void main(String[] args) {
        try {
            PrintStream consoleOut = System.out;
            PrintStream fileOut = new PrintStream("./src/main/java/com/xuhuan/example/example013/log.txt");
            System.setOut(fileOut);
            System.out.println("输出到文件的日志");
            System.setOut(consoleOut);
            System.out.println("输出到控制台的日志");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
